package com.pan.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class PrintTime {

    private static SimpleDateFormat datetimeFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
    private static SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd");
    private static SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");


    public static String nowDatetime(){
        long l = System.currentTimeMillis();
        return datetimeFormat.format(new Date(l));
    }

    public static String nowDate(){
        long l = System.currentTimeMillis();
        return dateFormat.format(new Date(l));
    }

    public static String nowTime(){
        long l = System.currentTimeMillis();
        return timeFormat.format(new Date(l));
    }

    public static void main(String[] args) {
        System.out.println(nowDatetime());

        System.out.println(nowDate());
        System.out.println(nowTime());

    }

}